class DriversController < ApplicationController
  def index
    @drivers = Driver.paginate(:page => params[:page], :per_page => 20, :order => "name")
  end

  def new
    @driver = Driver.new
  end

  def create
    @driver = Driver.new(params[:driver])

    respond_to do |format|
      if @driver.save
        format.html  { redirect_to(@driver,
                      :notice => 'Driver was successfully created.') }
        format.json  { render :json => @driver,
                      :status => :created, :location => @driver }
      else
        format.html  { render :action => "new" }
        format.json  { render :json => @driver.errors,
                      :status => :unprocessable_entity }
      end
    end
  end

  def show
    @active_tab = 'driver_details'
    @driver = Driver.find(params[:id])
  end
  
  def addresses
    @active_tab = 'driver_addresses'
    @driver = Driver.find(params[:id])
    
    render 'show'
  end
  
  def contacts
    @active_tab = 'driver_contacts'
    @driver = Driver.find(params[:id])
    
    render 'show'
  end

  def licenses
    @active_tab = 'driver_licenses'
    @driver = Driver.find(params[:id])
    
    render 'show'
  end
end
